package com.bjx.generator.controller;

import com.bjx.common.core.domain.R;
import com.bjx.generator.service.IDatabaseService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @desc: 代码控制器
 * @author: liushuai
 * @date: 2022/9/10 22:14
 */
@RestController
@Tag(name = "代码控制器")
@RequestMapping("/tool/database")
public class DatabaseController {
    @Autowired
    private IDatabaseService codeService;



    /**
     * 查询数据库中表名列表
     * @param
     * @return: com.bjx.common.core.domain.R
     * @Author: liushuai
     * @Date: 2022/9/10 22:18
     */
    @GetMapping("/listTableName")
    @Operation(summary = "查询数据库中表名列表")
    public R listTableName(@RequestParam String schemaName){
        List<String> tableNames = codeService.listTableName(schemaName);
        return R.success(tableNames);
    }
}
